<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<html>
<%@include file="../head-ui.jsp"%>
<link href="<%=request.getContextPath()%>/resources/jsframe/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<head>
    <title>巧艺平台</title>
</head>
<style>

</style>
<body>

<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
    <div id="loginform" class="loginBox">
        <div class="form form-horizontal">
            <div class="row cl">
                <label class="form-label col-3"><i class="Hui-iconfont">&#xe60d;</i></label>
                <div class="formControls col-8">
                    <input id="code" name="" type="text" placeholder="账户" class="input-text size-L">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-3"><i class="Hui-iconfont">&#xe60e;</i></label>
                <div class="formControls col-8">
                    <input id="pwd" name="" type="password" placeholder="密码" class="input-text size-L">
                </div>
            </div>
            <div class="formRow" style="text-align:left">
                <label class="form-label col-3"></label>
                <label id="errormesg" style="color:red"></label>
            </div>
            <div class="row">
                <div class="formControls col-8 col-offset-3">
                    <input id="submit" type="submit" class="btn btn-danger radius size-M"
                           style="width: 90%"
                           value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
                    <%--<input id="reset" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">--%>
                </div>
            </div>
        </div>
    </div>
</div>
<!--<div class="footer">中海科技</div>-->
</body>
</html>
<script>
    $(function(){
//        if (top.location != self.location){
//            top.location=self.location;
//        }
        $("#submit").click(function(){
            doLogin();
        })
        $("#reset").click(function(){
            $("#code").val("");
            $("#pwd").val("");
        })
        $('#pwd').bind('keypress',function(event){
            if(event.keyCode == "13")
            {
                doLogin();
            }
        });
        $('#code').bind('keypress',function(event){
            if(event.keyCode == "13")
            {
                doLogin();
            }
        });

    })
    function doLogin(){
        if($.trim($("#code").val())==""||$.trim( $("#pwd").val())==""){
            $("#errormesg").html("用户名和密码不能为空!");
            return;
        }
        $("#submit").val("登陆中......")
        $.ajax({
            type:'post',
            url:'<%=request.getContextPath()%>/back/login.do',
            data:{code:$.trim($("#code").val()),pwd:$.trim($("#pwd").val())},
            success:function(data){
                $("#submit").val("登陆")
                if(data.success=="true"){
                    if(data.url=="")
                    window.location.href="<%=request.getContextPath()%>/back/index.do"
                    else
                    window.location.href=data.url

                }else{
                    $("#errormesg").html("用户名或密码错误!");
                }
            }
        })
    }
// 登陆需要提示等待时使用
// var index = layer.load(2);
//     #hidebg { position:absolute;left:0px;top:0px;
//     background-color:#000;
//     width:100%;  /*宽度设置为100%，这样才能使隐藏背景层覆盖原页面*/
//    filter:alpha(opacity=60);  /*设置透明度为60%*/
//    opacity:0.6;  /*非IE浏览器下设置透明度为60%*/
//    display:none; /* http://www.jb51.net */
//    z-Index:2;
//    }
//    <div id="hidebg"></div>
//            layer.close(index);


</script>
